<?php
namespace App\Modules\Exchangerate;
use App\Modules\AdapterApi;
use App\Services\Exchangerate\ExchangerateIndex;
/**
 * Created by PhpStorm.
 * User: 97606
 * Date: 2018/6/12
 * Time: 10:10
 */
class Exchangerate extends AdapterApi
{
    /*添加一条汇率记录 注；若只传一个价格，则所有价格相同(仅适用于添加功能！)*/
    public function addRate(): array 
    {
        $data = pick_array($this->postData, ['max_price', 'min_price', 'open_price', 'close_price', 'now_price', 'token']);
        return ExchangerateIndex::Exchangerate()->addRate($data);
    }

    /*获取汇率记录列表（分页数据）*/
    public function rateList(): array 
    {
        $data = pick_array($this->postData, ['page', 'listRows', 'token']);
        return ExchangerateIndex::Exchangerate()->rateList($data);
    }

    /*修改其中一条记录*/
    public function updateRate(): array 
    {
        $data = pick_array($this->postData, ['id', 'max_price', 'min_price', 'open_price', 'close_price', 'now_price', 'token']);
        return ExchangerateIndex::Exchangerate()->updateRate($data);
    }

    /*删除一条汇率记录*/
    public function delOneRate(): array 
    {
        $data = pick_array($this->postData, ['id', 'token']);
        return ExchangerateIndex::Exchangerate()->delOneRate($data);
    }



}